<?php
	class TimeHandle{

		public function formatTime($time, $format){
			$result = "";
			if($time != null && $time != ""){
				if(strtotime($time) == false){
					$result = $time->format($format);
				}
				else{
					$result = date_create($time)->format($format);
				}
			}
			else
				$result = "";

			return $result;
		}

		public function getYear($year, &$startTime, &$endTime){

			$startTime = "1.1.".$year;
			$endTime = "1.1.".($year + 1);

		}

		public function getMonth($month, $year, &$startTime, &$endTime){

			$month = date("n",strtotime($month));

			$startTime = "1.".$month.".".$year;

			if($month == "12"){
				$endTime = "1.1.".($year+1);
			}
			else{
				$endTime = "1.".($month + 1).".".$year;
			}
		}

		public function getDay($day, &$startTime, &$endTime){
			$startTime = $day;
			$endTime = date('d.n.Y', strtotime($day .' +1 day'));
		}
	}
?>
